package com.siren.tank;

import java.io.IOException;
import java.util.Properties;

/**
 * @author : wangjichao
 * @description:
 * @date : 2020/7/28 17:25
 */
public class PropertyMgr {

    private static volatile PropertyMgr propertyMgr = null;

    private Properties props = new Properties();

    private static Object lock = new Object();

    private PropertyMgr() {
        try {
            props.load(PropertyMgr.class.getClassLoader().getResourceAsStream("config"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static PropertyMgr getInstance() {
        if (propertyMgr == null) {
            synchronized (lock) {
                if (propertyMgr == null) {
                    propertyMgr = new PropertyMgr();
                }
            }
        }
        return propertyMgr;
    }

    public String get(String key) {

        return (String)props.get(key);
    }

    public static void main(String [] args) {
    }

}
